
<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>企业认证</title>
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0, user-scalable=0, minimal-ui">
    <meta name="author" content="">
    <!-- Stylesheets -->
    <link rel="stylesheet" href="https://static.9hive.cn/global/css/bootstrap-extend.min.css?v2.2.0">

    <link rel="stylesheet" href="https://static.9hive.cn/global/vendor/bootstrap-3.3.7/bootstrap.min.css">

    <link rel="stylesheet" href="https://static.9hive.cn/global/vendor/bootstrap-select/bootstrap-select.min.css?v2.2.0">
    <link rel="stylesheet" href="https://static.9hive.cn/mmenu/assets/css/site.min.css?v2.2.0">
    <link rel="stylesheet" href="https://static.9hive.cn/global/fonts/font-awesome/font-awesome.min.css">
    <link rel="stylesheet" href="https://static.9hive.cn/global/vendor/multi-select/multi-select.min.css?v2.2.0">
    <link rel="stylesheet" href="https://static.9hive.cn/global/vendor/nprogress/nprogress.min.css">
    <link rel="stylesheet" href="https://static.9hive.cn/global/vendor/inside/inside.css?v=1">
    <link rel="stylesheet" href="https://static.9hive.cn/global/vendor/common/common_20170925.css">
    <link rel="stylesheet" href="https://nsr.9hive.cn/hive/assets/admin/admin2.css">
    <link rel="stylesheet" href="https://static.9hive.cn/global/vendor/custom/custom.css">

    <!--[if lt IE 9]>
    <script src="https://static.9hive.cn/global/vendor/html5shiv/html5shiv.min.js"></script>
    <![endif]-->

    <!--[if lt IE 10]>
    <script src="https://static.9hive.cn/global/vendor/media-match/media.match.min.js"></script>
    <script src="https://static.9hive.cn/global/vendor/respond/respond.min.js?v=1.2.2"></script>
    <![endif]-->
    <link href="https://static.9hive.cn/global/vendor/nprogress/nprogress.css" rel="stylesheet">
    <link href="https://static.9hive.cn/global/vendor/file/file.css" rel="stylesheet">
    <style>
        .form-control {
            height: 38px;
        }
        .logo:hover{
            cursor: pointer;
        }
        .hr_normal{
            margin-top: 0px;
        }
        .hr_active{
            margin-top: 0px;
        }

        .hover_img{
            width: 50px;
            height: 50px;
            background: rgba(8, 8, 8, 0.64);
            color: #fff;
            text-align: center;
            line-height: 50px;
            border-radius: 50%;
            position: absolute;
            margin-left: 12px;
            opacity: 0;
            cursor: pointer;
        }
        .hover_img:hover{
            opacity: 1;
        }


    </style>
</head>
<body class="certification_bac height_100p flexed_column padding-bottom-20">
<div class="page-content">
    <div class="flexed content_between">
        <div class="flexed content_alignCenter">
            <img class="brand-img" src="https://static.9hive.cn/hive/assets/images/joy.png" alt="..." >
            <h2 class="white font-size-20 margin-left-8">微米荟商城</h2>
        </div>

        <div class="brand">
            <a class="brand-a">官网首页</a>
            <a class="brand-a" href="/login">登录</a>
            <a href="/login/register">注册</a>
        </div>

    </div>

    <div class="hive-register-main">
        <div class="hive_form_content ">
            <div class="hive_form_content_left left_padding">
                <div class="font-size-30 text_left white">企业认证</div>
                <div>

                        <pre class="pre_text font-size-16 ">
专注为一线品牌提供全渠道品效营销
让营销的每一分钱产生数据价值

                        </pre>
                </div>

                <div class="footer_div text_left font-size-16 white">
                    上海微米荟商城科技有限公司
                </div>
            </div>


            <div class="hive_form_content_right">
                <div class="height_100p flexed_column content_center content_alignCenter">
                    <div class="width_100p">
                        <div class="hive_group ">
                            <label class="text-right"></label>
                            <ul id="progressbar" class="margin-left-12 width_100p">
                                <li class="active " id="li1" style="display: flex">
                                    <div class="flexed_column ">
                                        <img id="img1" src="https://static.9hive.cn/global/img/company.png" class="margin-left-12">
                                        <span>企业信息</span>
                                    </div>

                                </li>
                                <div class="flexed_column content_center flex_normal_1">
                                    <hr id="hr1" class=" hr_normal">
                                </div>
                                <li id="li2" class=" flexed">
                                    <div class="flexed_column ">
                                        <img id="img2" src="https://static.9hive.cn/global/img/card2.png" class="margin-left-16">
                                        <span>运营者信息</span>
                                    </div>

                                </li>
                                <div class="flexed_column content_center flex_normal_1">
                                    <hr id="hr2" class=" hr_normal" >
                                </div>
                                <li id="li3" class="">
                                    <div class="flexed_column ">
                                        <img id="img3" src="https://static.9hive.cn/global/img/certify2.png" class="margin-left-12">
                                        <span>提交审核</span>
                                    </div>
                                </li>
                            </ul>

                        </div>
                    </div>
                    <form id="msform" class="form-horizontal form-validate width_100p" role="form"
                          style="min-height: 60%">

                        <fieldset id="fieldset1">
                            <div class="hive_group relative_position" style="line-height: 60px" >
                                <label class="text-right">品牌LOGO</label>
                                <div class="text-left flexed" style="line-height: 27px">
                                    <div class="hover_img"  onclick="_logo();">
                                        上传
                                    </div>
                                    <%if(isNotEmpty(ci.brandLogo)){%>
                                        <img src="${ci.brandLogo! 'https://static.9hive.cn/global/img/joy.png'}" class="logo img-rounded" id="logo""/>
                                    <%}else{%>
                                        <img src="/res/img/9joy.png" class="logo img-rounded" id="logo" onclick="_logo();"/>
                                    <%}%>

                                    <input type="hidden" id="brandLogo" value="${ci.brandLogo!}"/>
                                    <input type ="file" id="_brandLogo" name="brandLogo" style="display: none"/>

                                    <div class="inline">
                                        <span class="font-size-13">上传规格：320x320px</span><br>
                                        <span class="font-size-13">上传格式：为png，小于500kb</span>
                                    </div>
                                </div>


                            </div>


                            <div class="hive_group">
                                <label class="text-right">品牌名称</label>
                                <input class="form-control light-input" placeholder="请输入品牌名称" id="brandName" value="${ci.brandName!}">


                            </div>
                            <div class="hive_group">
                                <label class="text-right">企业名称</label>
                                <input class="form-control light-input " placeholder="需与当地政府颁发的企业注册证上的企业名称完全一致" id="company_name" value="${ci.company_name!}">

                            </div>
                            <div class="hive_group">
                                <label class="text-right">所属行业</label>
                                    <div class="col-sm-6">
                                        <select name="category_one" class="form-control light-input" id="category_one" style="background-color: transparent;"></select>
                                    </div>
                                    <div class="col-sm-6">
                                        <select name="category_two" class="form-control light-input" id="category_two" style="background-color: transparent;"></select>
                                    </div>

                                    <script src="/res/plugins/jiuyue/category_select.js"></script>
                                    <script type="text/javascript">
                                        new category('category_one', 'category_two', '${category_one!}', '${category_two!}');
                                    </script>

                            </div>
                            <div class="hive_group">
                                <label class="text-right">营业执照注册号</label>
                                <input class="form-control light-input" placeholder="请输入15位营业执照注册号或18位的统一社会信用代码" id="business_licence_code" value="${ci.business_licence_code}">
                            </div>
                            <div class="hive_group">
                                <label class="text-right">营业执照扫描件</label>
                                <%if(isNotEmpty(ci.imgName)){%>
                                    <div class="form-control  hive-btn-md-large" id="btn_licence_img" style="background-color: #E8F8FC;border: solid 1px #15baff;" onclick="business_licence_img()">${ci.imgName}</div>
                                <%}else{%>
                                    <div class="form-control  hive-btn-md-large" id="btn_licence_img" style="background-color: #E8F8FC;border: solid 1px #15baff;" onclick="business_licence_img()">上传文件</div>
                                <%}%>
                                <input type="hidden" id="business_licence_img" value="${ci.business_licence_img}"/>
                                <input type="hidden" id="imgName" value="${ci.imgName}"/>
                                <input type ="file" id="_licence_img" name="licence_img" style="display: none"/>
                            </div>
                            <div class="hive_group" style="width: 73%">
                                <label class="text-right"></label>
                                <label  class="form-control " style="color: #bfcbd4;border: none;padding-left: 0px;padding-top: 0px">上传营业执照原件或扫描件；文件只支持jpg、png格式；大小不超过5M</label>
                            </div>

                            <div class="hive_group">
                                <label class="text-right"></label>
                                <button type="button" name="next"
                                        class="next form-control hive-btn-md-large hive-btn-primary "
                                        value="">
                                    下一步
                                </button>

                            </div>


                        </fieldset>
                        <fieldset class="fieldset" id="fieldset2">

                            <div class="hive_group">
                                <label class="text-right">电子邮箱</label>

                                <input type="text" id="email" value="${ci.email}" placeholder="建议用企业邮箱申请"
                                       class=" light-input form-control">
                            </div>

                            <div class="hive_group">
                                <label class="text-right">邮件验证码</label>
                                <input type="text" id="emailCode" value="" class="form-control light-input"
                                       placeholder="请输入邮件验证码">
                                <button id="sendEmailCode" class="hive-btn-md-large  margin-left-8" type="button" value="">
                                    验证邮箱
                                </button>
                            </div>

                            <div class="hive_group">
                                <label class="text-right">运营者手机号</label>
                                <input id="phone" value="${ci.phone!}" class="form-control light-input" readonly>

                            </div>
                            <div class="hive_group">
                                <label class="text-right">短信验证码</label>
                                <input type="text" id="phoneCode" value="" class="form-control light-input"
                                       placeholder="请输入短信验证码">


                                <button id="sendPhoneCode" class="hive-btn-md-large  margin-left-8" type="button" value="">
                                    获取验证码
                                </button>

                            </div>
                            <div class="hive_group">
                                <label class="text-right">运营者姓名</label>

                                <input type="text" id="personInCharge" value="${ci.personInCharge!}" class="form-control light-input">

                            </div>

                            <div class="hive_group">
                                <label> </label>
                                <div class="flexed width_100p margin-left-12 content_between">

                                    <button type="button"
                                            class="previous hive-btn-md-cancle"
                                            style="width: 47% ;"
                                            value="上一步">上一步
                                    </button>
                                    <button type="submit" name="next" class="submit action-button hive-btn-md-large hive-btn-primary"
                                            style="width: 47%"
                                            value="下一步">提交审核
                                    </button>
                                </div>

                            </div>


                        </fieldset>

                    </form>

                    <div class=" certifcation_p fieldset" id="last">
                        <div class="flexed_column margin-top-80 content_alignCenter height_100p posotion_abs width_100p">
                            <img class="" src="https://static.9hive.cn/global/img/certification_ing.png">
                            <span class="font-size-16 margin-bottom-10 font-blue">提交成功，你的企业认证正在审核中！</span>
                            <span>审核时间约1-2个工作日，审核结果我们会以短信和邮件的形式通知你，请注意查收！</span>
                        </div>
                    </div>
                </div>

            </div>


        </div>

    </div>
</div>
<div class="text-center" style="align-items: flex-end">
    <footer class="white">Copyright All Rights Reserved © 2017</footer>
</div>

<script src="https://static.9hive.cn/global/vendor/jquery/jquery-2.1.4.min.js"></script>
<script src="https://static.9hive.cn/global/vendor/bootstrap-3.3.7/bootstrap.min.js"></script>
<script src="https://static.9hive.cn/global/vendor/jquery-export/jquery-export.js"></script>
<script src="https://static.9hive.cn/global/vendor/bootstrap-select/bootstrap-select.min.js"></script>
<script src="https://static.9hive.cn/global/vendor/nprogress/nprogress.js"></script>
<script src="https://static.9hive.cn/global/vendor/multi-select/jquery.multi-select.js"></script>
<script src="https://static.9hive.cn/global/vendor/jquery-validate/jquery.validate.min.js"></script>
<script src="https://static.9hive.cn/global/vendor/jquery-validate/additional-methods.min.js"></script>
<script src="https://static.9hive.cn/global/vendor/jquery-validate/localization/messages_zh.min.js"></script>
<script src="https://static.9hive.cn/global/vendor/inside/inside20170925.js"></script>
<script src="https://static.9hive.cn/global/js/core.min.js"></script>
<script src="https://static.9hive.cn/mmenu/assets/js/site.min.js"></script>
<script src="https://static.9hive.cn/global/vendor/layer/layer.js"></script>
<!--<script src="https://static.9hive.cn/global/js/components/bootstrap-select.min.js"></script>-->
<script src="https://static.9hive.cn/global/js/components/multi-select.min.js"></script>
<!--<script src="https://static.9hive.cn/hive/assets/js/certification.js"></script>-->


<!-- 自定义js -->
<script src="https://static.9hive.cn/global/vendor/inside/inside20170925.js"></script>
<script src="https://static.9hive.cn/global/vendor/file/uploadify/jquery_uploadify.js"></script>
<script src="/res/js/ajaxfileupload.js"></script>
<script>

    //ajaxfileupload上传logo
    function _logo() {
        $('#_brandLogo').click();
        $('#_brandLogo').on('change', function () {
            $.ajaxFileUpload({
                url: "/file/newuploadfile?shopId=0&type=d",
                type: "GET",
                secureuri: false,
                fileElementId: '_brandLogo',//file标签的id
                dataType: 'json',//返回数据的类型
                //data: {"id": v},//一同上传的数据
                success: function (data) {
                    if(data.code==0){
                        $("#logo").attr("src",data.url);
                        $("#brandLogo").val(data.url);
                    }else{
                        layer.msg("失败");
                    }

                },
                error:function (data) {
                    layer.msg("失败");


                }
            });
        })

    }

    //ajaxfileupload上传营业执照扫描件
    function business_licence_img() {
        $('#_licence_img').click();
        $('#_licence_img').on('change', function () {
            $.ajaxFileUpload({
                url: "/file/newuploadfile?shopId=0&type=d",
                type: "GET",
                secureuri: false,
                fileElementId: '_licence_img',//file标签的id
                dataType: 'json',//返回数据的类型
                //data: {"id": v},//一同上传的数据
                success: function (data) {
                    if(data.code==0){
                        $("#btn_licence_img").html(data.resFileName);
                        $("#business_licence_img").val(data.url);
                        $("#imgName").val(data.resFileName);
                    }else{
                        layer.msg("失败");
                    }

                },
                error:function (data) {
                    layer.msg("失败");


                }
            });
        })

    }
    (function (document, window, $) {
        'use strict';

        var Site = window.Site;
        $(document).ready(function () {
            Site.run();
        });
    })(document, window, jQuery);
</script>

<!-- 自定义js -->

<script src="https://static.9hive.cn/global/vendor/file/uploadify/jquery_uploadify.js"></script>
<script>
    $('.next').click(function () {
        var brandLogo=$("#brandLogo").val();
        var brandName=$("#brandName").val();
        var company_name=$("#company_name").val();
        var business_licence_code=$("#business_licence_code").val();//
        var business_licence_img=$("#business_licence_img").val();
        if(!brandLogo){
            layer.msg("请上传品牌LOGO!");
            return false;
        }
        if(!brandName){
            layer.msg("请填写品牌名称!");
            return false;
        }
        if(!company_name){
            layer.msg("请填写企业名称!");
            return false;
        }
        if(!business_licence_code){
            layer.msg("请填写营业执照注册号!");
            return false;
        }
        if(!business_licence_img){
            layer.msg("请上传营业执照扫描件!");
            return false;
        }
        /*   $("#li1").addClass('active');*/
        $("#li2").addClass('active');
        $("#hr1").removeClass("hr_normal").addClass('hr_active');
        $("#img2").attr('src', 'https://static.9hive.cn/global/img/card1.png');

        $("#fieldset1").hide();
        $("#fieldset2").show();


    });
    $('.previous').click(function () {
        $("#li2").removeClass('active');
        $("#hr2").removeClass('hr_active').addClass("hr_normal");
        $("#img2").attr('src', 'https://static.9hive.cn/global/img/card2.png');
        $("#fieldset1").show();
        $("#fieldset2").hide();

    });
    $('.submit').click(function () {
        //$("#li3").addClass('active');
        $("#hr2").removeClass("hr_normal").addClass('hr_active');
        //$("#img3").attr('src', 'https://static.9hive.cn/global/img/certify1.png');
        var imgName=$("#imgName").val();
        var brandLogo=$("#brandLogo").val();
        var brandName=$("#brandName").val();
        var category_one=$("#category_one").val();//一级类目
        var category_two=$("#category_two").val();//二级类目
        var company_name=$("#company_name").val();
        var business_licence_code=$("#business_licence_code").val();//
        var business_licence_img=$("#business_licence_img").val();
        var email=$("#email").val();
        var emailCode=$("#emailCode").val();
        var personInCharge=$("#personInCharge").val();
        var phone=$("#phone").val();
        var phoneCode=$("#phoneCode").val();
        var regEmail =/^[\w!#$%&'*+/=?^_`{|}~-]+(?:\.[\w!#$%&'*+/=?^_`{|}~-]+)*@(?:[\w](?:[\w-]*[\w])?\.)+[\w](?:[\w-]*[\w])?$/; //邮箱正则表达式
        if(!brandLogo){
            layer.msg("请上传品牌LOGO!");
            return false;
        }
        if(!brandName){
            layer.msg("请填写品牌名称!");
            return false;
        }
        if(!company_name){
            layer.msg("请填写企业名称!");
            return false;
        }
        if(!business_licence_code){
            layer.msg("请填写营业执照注册号!");
            return false;
        }
        if(!business_licence_img){
            layer.msg("请上传营业执照扫描件!");
            return false;
        }
        if(!regEmail.test(email)){
            layer.msg("请输入正确的邮箱格式!");
            return false;
        }
        if(!emailCode){
            layer.msg("请输入邮箱验证码!");
            return false;
        }
        if(!personInCharge){
            layer.msg("请输入运营者姓名!");
            return false;
        }
        if(!phoneCode){
            layer.msg("请输入短信验证码!");
            return false;
        }
        $.ajax({
            url: "/shop/companyinfo/certificationSave",
            type: 'GET',
            data:{
                "brandLogo": brandLogo,
                "brandName": brandName,
                "company_name": company_name,
                "business_licence_code": business_licence_code,
                "business_licence_img": business_licence_img,
                "email": email,
                "emailCode": emailCode,
                "personInCharge": personInCharge,
                "phone": phone,
                "phoneCode": phoneCode,
                "categories":category_one+","+category_two,
                "imgName":imgName
            },
            success: function(data){
                if (data.state=="ok" == true){
                    window.location.href="/shop/companyinfo/incertificationForm";
                }else{
                    layer.msg(data.info);
                }
            }});

        return false;
    });
</script>
<script>
    $("#sendPhoneCode").on('click', function () {
        var regPhone = /^0?(13[0-9]|15[0-9]|17[0-9]|18[0-9]|14[57])[0-9]{8}$/ ; //手机正则表达式
        var phone=$("#phone").val();
        if(!regPhone.test(phone)){
            layer.msg("请输入正确的手机号!");
            return false;
        }
        $.ajax({
            url: "/shop/companyinfo/getPhoneCode",
            type: 'GET',
            data:{
                "phone": phone
            },
            success: function(data){
                if (data.state=="ok" == true){
                    layer.msg("验证码发送成功");
                    setPhoneTime();
                }else{
                    layer.msg(data.info);
                }
            }});

    });
    var phonetime = 60;
    function setPhoneTime() {
        phonetime--;
        $("#sendPhoneCode").attr('disabled', 'disabled');
        $("#sendPhoneCode").html(phonetime + " s ");
        if (phonetime > 0) {
            setTimeout(setPhoneTime, 1000);
        } else {
            $("#sendPhoneCode").attr('disabled', false);
            $("#sendPhoneCode").html("验证码");
            phonetime = 60;
        }
    }


    //邮箱验证码
    $("#sendEmailCode").on('click', function () {
        var regEmail =/^[\w!#$%&'*+/=?^_`{|}~-]+(?:\.[\w!#$%&'*+/=?^_`{|}~-]+)*@(?:[\w](?:[\w-]*[\w])?\.)+[\w](?:[\w-]*[\w])?$/; //邮箱正则表达式
        var email=$("#email").val();
        if(!regEmail.test(email)){
            layer.msg("请输入正确的邮箱格式!");
            return false;
        }

        $.ajax({
            url: "/shop/companyinfo/getEmailCode",
            type: 'GET',
            data:{
                "email": email
            },
            success: function(data){
                if (data.state=="ok" == true){
                    layer.msg("验证码发送成功");
                    setEmailTime();
                }else{
                    layer.msg(data.info);
                }
            }});

    });
    var emailtime = 60;
    function setEmailTime() {
        emailtime--;
        $("#sendEmailCode").attr('disabled', 'disabled');
        $("#sendEmailCode").html(emailtime + " s ");
        if (emailtime > 0) {
            setTimeout(setEmailTime, 1000);
        } else {
            $("#sendEmailCode").attr('disabled', false);
            $("#sendEmailCode").html("验证码");
            emailtime = 60;
        }
    }


</script>
</body>
</html>